package com.dayatang.exam.domain;

import javax.persistence.Embeddable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.dayatang.domain.ValueObject;

@Embeddable
public class UserContactInfo implements ValueObject {

	private static final long serialVersionUID = 4181544166079639439L;
	
	private String email;

	private String mobileNumber;
	
	private String telNumber;
	
	/**
	 * QQ号码
	 */
	private String qqNumber;
	
	/**
	 * MSN号码
	 */
	private String msnNumber;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobileNumber() {
		return mobileNumber;
	}

	public void setMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
	}

	public String getTelNumber() {
		return telNumber;
	}

	public void setTelNumber(String telNumber) {
		this.telNumber = telNumber;
	}

	public String getQqNumber() {
		return qqNumber;
	}

	public void setQqNumber(String qqNumber) {
		this.qqNumber = qqNumber;
	}

	public String getMsnNumber() {
		return msnNumber;
	}

	public void setMsnNumber(String msnNumber) {
		this.msnNumber = msnNumber;
	}

	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof UserContactInfo))
			return false;
		UserContactInfo castOther = (UserContactInfo) other;
		return new EqualsBuilder().append(email, castOther.email).append(
				mobileNumber, castOther.mobileNumber).append(telNumber,
				castOther.telNumber).append(qqNumber, castOther.qqNumber)
				.append(msnNumber, castOther.msnNumber).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(email).append(mobileNumber).append(
				telNumber).append(qqNumber).append(msnNumber).toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append("email", email).append(
				"mobileNumber", mobileNumber).append("telNumber", telNumber)
				.append("qqNumber", qqNumber).append("msnNumber", msnNumber)
				.toString();
	}

}
